package com.atguigu.cloud.feignapis;

import com.atguigu.cloud.entities.PayDTO;
import com.atguigu.cloud.resp.ResultData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Author liking
 * @Description
 * @Date 2025/4/24
 * @Version 1.0
 */
@FeignClient(value = "cloud-payment-service")
public interface PayFeignApi {

    @PostMapping("/pay/createPay")
    public ResultData addPay(@RequestBody PayDTO payDTO);
    @GetMapping("/pay/getPayById/{id}")
    public ResultData getPayById(@PathVariable("id") Integer id);


    @PostMapping("/pay/updatePay")
    public ResultData updatePay(@RequestBody PayDTO payDTO);

    @GetMapping("/yaml/info")
    public String getYamlInfo();

    @GetMapping("/pay/getPayList")
    public ResultData getAllList();
    /*
    * 模拟feign 调用超时
    *
    * */
    @GetMapping("/pay/connectTimeOut")
    public ResultData connectTimeOut();

    /**
     * Resilience4j CircuitBreaker 的例子
     * @param id
     * @return
     * 服务熔断 案例
     */
    @GetMapping(value = "/pay/circuit/{id}")
    public String myCircuit(@PathVariable("id") Integer id);


    /**
     * Resilience4j Bulkhead 的例子
     * @param id
     * @return
     */
    @GetMapping(value = "/pay/bulkhead/{id}")
    public String myBulkhead(@PathVariable("id") Integer id);


/*
* 使用 了 getway 网关 后 调用的。
* */
    @GetMapping(value = "/pay/gateway/info")
    public ResultData<String> getGatewayInfo();


    @GetMapping(value = "/pay/gateway/get/{id}")
    public ResultData getById(@PathVariable("id") Integer id);
}
